package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.ActivityAward;
import com.sc.nft.entity.MallGoodsLabel;
import com.sc.nft.entity.dto.MallGoodsLabelPageDTO;
import com.sc.nft.entity.vo.MallGoodsLabelItemPageVO;
import com.sc.nft.entity.vo.MallGoodsLabelPageVO;
import com.sc.nft.mapper.ActivityAwardMapper;
import com.sc.nft.mapper.MallGoodsLabelMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

@Slf4j
@Repository
public class MallGoodsLabelDao extends ServiceImpl<MallGoodsLabelMapper, MallGoodsLabel> {
    public void updateStatus(Long id, Boolean status) {
        LambdaUpdateWrapper<MallGoodsLabel> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(MallGoodsLabel::getId,id);
        updateWrapper.set(MallGoodsLabel::getStatus,status);
        update(updateWrapper);
    }

    public IPage<MallGoodsLabelPageVO> pageList(MallGoodsLabelPageDTO mallGoodsLabelPageDTO) {
        return baseMapper.pageList(mallGoodsLabelPageDTO.toMp(),mallGoodsLabelPageDTO);
    }

    public void removeLabel(Long id) {
        LambdaUpdateWrapper<MallGoodsLabel> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(MallGoodsLabel::getId,id);
        remove(updateWrapper);
    }

    public List<MallGoodsLabelItemPageVO> goodsPage(Long mallLabelId) {
        return baseMapper.goodsPage(mallLabelId);
    }

    public List<MallGoodsLabel> productDetailsGetLabel(Long mallActivityId) {
        return baseMapper.productDetailsGetLabel(mallActivityId);
    }
}
